package com.ihrm.employee.service.impl;

import com.ihrm.domain.employee.EmployeeResignation;
import com.ihrm.employee.mapper.EmployeeResignationMapper;
import com.ihrm.employee.service.api.ResignationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.imageio.spi.RegisterableService;
import java.util.Date;

/**
 * Created with IDEA
 * Author:xzengsf
 * Date:2018/10/20 14:23
 * Description:
 */
@Service
public class ResignationServiceImpl implements ResignationService {

    @Autowired
    private EmployeeResignationMapper employeeResignationMapper;

    public void update(EmployeeResignation resignation) {
        resignation.setCreateTime(new Date());
        employeeResignationMapper.updateByPrimaryKeySelective(resignation);
    }

    @Override
    public void insert(EmployeeResignation resignation) {
        resignation.setCreateTime(new Date());
        employeeResignationMapper.insertSelective(resignation);
    }

    public EmployeeResignation findById(String userId) {
        return employeeResignationMapper.selectByPrimaryKey(userId);
    }
}
